
interface Shape {
    double getArea();
}

class Circle implements Shape {
    private double radius;

    public Circle(double radius) {
        this.radius = radius;
    }

    @Override
    public double getArea() {
        return Math.PI * radius * radius;
    }
}

class Rectangle implements Shape {
    private double width;
    private double height;

    public Rectangle(double width, double height) {
        this.width = width;
        this.height = height;
    }

    @Override
    public double getArea() {
        return width * height;
    }
}


class ShapeFactory {
    public static Shape createShape(String shapeType, double... params) {
        if ("circle".equals(shapeType)) {
            return new Circle(params[0]);
        } else if ("rectangle".equals(shapeType)) {
            return new Rectangle(params[0], params[1]);
        }
        return null;
    }
}

public class FactoryPatternDemo {
    public static void main(String[] args) {
        Shape circle = ShapeFactory.createShape("circle", 5.0);
        System.out.println("Circle area: " + circle.getArea());

        Shape rectangle = ShapeFactory.createShape("rectangle", 4.0, 6.0);
        System.out.println("Rectangle area: " + rectangle.getArea());
    }
}